<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
   <%@include file="include.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>修改个人信息</title>
</head>

<body>

<br>
<br>
<br>
<br>






<div class="tabcontrol" data-role="tabcontrol" data-open-target="#frame_0">
    <ul class="tabs">
    	<li><a href="#frame_0">查看基本信息</a></li>
    
        <li><a href="#frame_1">修改基本信息</a></li>
        
        <li><a href="#frame_2">修改密码</a></li>
    </ul>

    <div class="frames">
     <div class="frame" id="frame_0">
     
     
     <table class="table striped dataTable border bordered" id="dataTables-1" style="width:100%;">
                <thead>
                <tr>
                    <th class="text-left">用户名</th>
                    <th class="text-left">昵称</th>
					<th class="text-left">生日</th>
					<th class="text-left">注册时间</th>
					
                </tr>
                </thead>

                <tbody>
                <tr><td>${username}</td>
                	<td>${nickname}</td>
                	<td>${birthday}</td>
                	<td>${createTime}</td>
                </tr>
                </tbody>
            </table>
     
     </div>
    
        <div class="frame" id="frame_1">
        
        <label>输入新昵称</label>
<div class="input-control text info">
<input type="text" id="t1" name="updateUser.nickname">
</div>
<label>选择出生日期</label>
<div class="input-control text" data-role="datepicker">
    <input type="text" id="ct">
    <button class="button"><span class="mif-calendar"></span></button>
</div>

<button id="bt1"  class="button primary"> 提交</button>
        
        <p>注：重新登录后生效。</p>
        </div>
       
        <div class="frame" id="frame_2">
        <div class="input-control password info d" data-role="input"><label>输入原密码</label>
<input type="password" id="t2" ><button class="button helper-button reveal"><span class="mif-looks"></span></button> <p id="r1"></p>
</div>
<div class="input-control password info p" data-role="input"><label>输入新密码</label>
<input type="password" id="t3" ><button class="button helper-button reveal"><span class="mif-looks"></span></button>
</div>
<div class="input-control password info p" data-role="input"><label>再次输入新密码</label>
<input type="password" id="t4" ><button class="button helper-button reveal"><span class="mif-looks"></span></button><p id="r2"></p>
</div>
<button id="bt2" class="button primary"> 提交</button>
</div>
    </div>
</div>







<script type="text/javascript">
$(document).ready(function(){
	$("#bt1").click(function(){
		var nn=$("#t1").val();
		var date=$("#ct").val();
		alert(date);
		$.post("updateUser.action",{nickname:nn,birthday:date});
	});
	$("#t2").blur(function(){
		if($("#t2").val()==""){
			$("#r1").html("原密码不能为空！");
			$(".d").removeClass("info");
			$(".d").addClass("error");
			$("#bt2").prop("disabled",true);
			}else{
			$("#bt2").prop("disabled",false);
			$(".d").addClass("info");
			$("#r1").html("")
			}
		});
	
	
	$("#t4").blur(function(){
		if($("#t4").val()!=$("#t3").val()){
			$("#bt2").prop("disabled",true);
			$(".p").removeClass("info");
			$(".p").addClass("error");
			$("#r2").html("两次密码不一致,请重新输入！");
		}else{
			$("#bt2").prop("disabled",false);
			$("#r2").html("");
			$(".p").addClass("info");
		}
			
	});
	$("#bt2").click(function(){
		var oldPassword=$("#t2").val();
		var newPassword1=$("#t3").val();
		var newPassword2=$("#t4").val();
		$.post("password.action",{oldPassword:oldPassword,newPassword1:newPassword1,newPassword2:newPassword2},function(res){
			
			alert(res);
			$("#r1").val("")
			$("#r2").val("")
			$("#t2").val("")
			$("#t3").val("")
			$("#t4").val("");
		})
	});
	
	
	
});



</script>
</body>
</html>